package com.lianxian.xindong.me.di.module;

import androidx.fragment.app.Fragment;

import com.hxb.library.di.scope.ActivityScope;
import com.lianxian.xindong.commonres.adapter.MyPagerTitleAdapter;
import com.lianxian.xindong.me.R;
import com.lianxian.xindong.me.mvp.contract.FriendDetailContract;
import com.lianxian.xindong.me.mvp.model.FriendDetailModel;
import com.lianxian.xindong.me.mvp.ui.fragment.FriendCirclesFragment;
import com.lianxian.xindong.me.mvp.ui.fragment.FriendInfoFragment;
import com.lianxian.xindong.me.mvp.ui.fragment.WorksSelfieFragment;
import com.lianxian.xindong.me.mvp.ui.fragment.WorksShopFragment;

import java.util.ArrayList;

import dagger.Binds;
import dagger.Module;
import dagger.Provides;


/**
 * @作者：hexingbo
 * @时间：07/07/2023
 * @描述：
 */
@Module
public abstract class FriendDetailModule {

    @Binds
    abstract FriendDetailContract.Model bindFriendInfoModel(FriendDetailModel model);

    @ActivityScope
    @Provides
    static ArrayList<Fragment> provideFragments() {
        ArrayList<Fragment> fragments = new ArrayList<>();
        fragments.add(new FriendInfoFragment());
        fragments.add(new FriendCirclesFragment());
        fragments.add(new WorksSelfieFragment());
        fragments.add(new WorksShopFragment());
        return fragments;
    }

    @ActivityScope
    @Provides
    static String[] provideTitles(FriendDetailContract.View view) {
        return view.getContext().getResources().getStringArray(R.array.friend_table_values);

    }

    @ActivityScope
    @Provides
    static MyPagerTitleAdapter provideAdapter(FriendDetailContract.View view, String[] titles, ArrayList<Fragment> fragments) {
        MyPagerTitleAdapter adapter = new MyPagerTitleAdapter(view.getSupportFragmentManager(), titles, fragments);
        return adapter;

    }

}